<%@ Page Title="Projects" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master"
    AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage<ProjectListView>" %>

<%@ Import Namespace="good1.Core" %>
<%@ Import Namespace="good1.Web.Controllers" %>
<asp:Content ContentPlaceHolderID="mainContentPlaceHolder" runat="server">
    <% if (ViewContext.TempData["message"] != null)
       { %>
    <p>
        <%= ViewContext.TempData["message"]%></p>
    <% } %>
     <%
         foreach (ProjectListItem project in ViewData.Model.ProjectList)
        { %>
    <div class="project-summary">
        <div class="project-photo">
            <a href="/projects/show/<%=project.Id %>" alt="full project details of <%= project.Title %>"><img src="<%= project.PhotoUrl %>" alt="" id="Img1<%= project.Id %>" /></a>
        </div>
        <div class="project-details">
            <div class="project-title">
                <%= project.Title %></div>
            <div class="project-text">
                <%= (project.Text.LastIndexOf(" ") < 251) ? project.Text :  project.Text.Substring(0, project.Text.IndexOf(" ", 250)) %>... 
                <%= Html.ActionLink<ProjectsController>(c => c.Show(project.Id), "more")%>
            </div>
            <div class="project-trumps">
                <div class="key">Project Cost: </div><div  class="value"><%= project.Amount %></div>
                <div class="key">Target Date: </div><div  class="value"><%= project.ClosingDate %> </div>
                 <div class="key">Location: </div><div  class="value"><%= project.LocationName %> </div>
                 <div class="key">Country: </div><div  class="value"><%= project.LocationCountryName %> </div>
                <div class="key">Charity: </div><div  class="value"><%= project.CharityName %> </div>
               
                <% Html.RenderPartial("DonateButton", ViewData); %>
            
            
            </div>
        </div>     <%    if (Request.IsAuthenticated)
{%>
                     <%=Html.ActionLink<ProjectsController>( c => c.Edit(project.Id), "Edit")%> <%

    using (Html.BeginForm<ProjectsController>(c => c.Delete(project.Id)))
    {%>
            <%=Html.AntiForgeryToken()%>
            <input type="submit" value="Delete" size=".5em" onclick="return confirm('Are you sure?');" />
            <%
    }
}%>
         <%= Html.ActionLink("Log Off", "LogOut", "ThirdPartyIdentities") %> 
        <br class="clear" />
        <br class="clear" />
    </div>
    <%} %>
 
</asp:Content>
